<?php
/**
 * Created by PhpStorm .
 * User: {Administrator}
 * Date: {2022/7/6 16:37}
 * Author: '树叶'
 * Email: 'ayunu@qq.com'
 * Motto Info: '理想如果不向现实做一点点屈服，那么理想也将归于尘土。'
 */

namespace app\api\model;
use think\Db;
use think\Model;

class SystemUser extends Model
{
    protected $name = 'system_user';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $resultSetType = 'collection';
    // 追加属性
    protected $append = [
    
    ];

    /**
     * 通知列表
     * @return bool|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getSystemUser($uid)
    {
       $response = SystemUser::where('user_id',$uid)->field('admin_id', true)->select()->toArray();
       return $response;
    }

    /**
     * @param $id 通知ID
     */
    public static function getSystemUserId($id)
    {
        $response = SystemUser::where('id',$id)->field('admin_id', true)->find();
        if ($response)
        {
            return $response;
        }else{
            return false;
        }
    }

    public static function getSystemOrder($uid = 0)
    {
        $response = Db::name('system_order')->where('uid',$uid)->field('admin_id',true)->select();
        return $response;
    }

}